home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / editors / emacs / xemacs / xemacs-1.006 / xemacs-1 / lib / xemacs-19.13 / lisp / term / x-win-sun.el < prev    next >
Encoding:
Text File  |  1995-08-09  |  4.5 KB  |  127 lines

  1. ;;; x-win-sun.el --- runtime initialization for Sun X servers and keyboards
  2. ;; Copyright (C) 1993, 1994 Free Software Foundation, Inc.
  3.  
  4. ;; Author: jwz@lucid.com
  5. ;; Keywords: terminals
  6.  
  7. ;; This file is part of XEmacs.
  8.  
  9. ;; XEmacs is free software; you can redistribute it and/or modify it
  10. ;; under the terms of the GNU General Public License as published by
  11. ;; the Free Software Foundation; either version 2, or (at your option)
  12. ;; any later version.
  13.  
  14. ;; XEmacs is distributed in the hope that it will be useful, but
  15. ;; WITHOUT ANY WARRANTY; without even the implied warranty of
  16. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  17. ;; General Public License for more details.
  18.  
  19. ;; You should have received a copy of the GNU General Public License
  20. ;; along with XEmacs; see the file COPYING.  If not, write to the Free
  21. ;; Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  22.  
  23. ;;; Commentary:
  24.  
  25. ;; This file is loaded by x-win.el at run-time when we are sure that XEmacs
  26. ;; is running on the display of a Sun.
  27.  
  28. ;; The Sun X server (both the MIT and OpenWindows varieties) have extremely
  29. ;; stupid names for their keypad and function keys.  For example, the key
  30. ;; labeled 3 / PgDn, with R15 written on the front, is actually called F35.
  31.  
  32. ;; Since we don't yet have a key-translation-map, we do this kludge to repair
  33. ;; things.  We do bindings of the keys which are actually generated by the
  34. ;; keyboard, to give them sensible names.  The user can then bind either
  35. ;; (for example) `pgdn' or `f35' and get the expected behavior.
  36.  
  37. ;; Once key-translation-map exists, this should be done differently.
  38. ;; The current implementation has the bug that `C-x f35' does not get
  39. ;; translated to `C-x pgdn'.  (But we do translate `C-f35' to `C-pgdn'.)
  40.  
  41. ;;; Code:
  42.  
  43. ;;; #### bleck bleck bleck!!!!  This junk needs to be done using
  44. ;;; key-translation-map.
  45. ;;;
  46. ;;; #### Actually, we need to think about this more.  What we really
  47. ;;; want is to have a way of converting the raw keysyms: e.g.
  48. ;;; `r13' with any modifiers should be mapped to `end' with the same
  49. ;;; modifiers.  key-translation-map doesn't do this.
  50. ;;;
  51. ;;; FSF Emacs has something called `system-key-alist' that is
  52. ;;; supposed to accomplish approximately the same thing.  Unfortunately,
  53. ;;; it's brain-dead in the typically FSF way, and associates *numbers*
  54. ;;; (who knows where the hell they come from?) with symbols.
  55. ;;;
  56. ;;; Maybe we should add something like `keyboard-translate-alist'?
  57.  
  58. (let ((mapping '((f11 . stop)        ; the type4 keyboard Sun/MIT name
  59.          (f36 . stop)        ; the type5 keyboard Sun name
  60.          (cancel . stop)    ; R6 binding
  61.          (f12 . again)        ; the type4 keyboard Sun/MIT name
  62.          (f37 . again)        ; the type5 keyboard Sun name
  63.          (f13 . props)
  64.          (SunProps . props)    ; R6 binding
  65.          (f14 . undo)
  66.          (f15 . front)
  67.          (SunFront . front)    ; R6 binding
  68.          (f16 . copy)
  69.          (SunCopy . copy)    ; R6 binding
  70.          (f17 . open)
  71.          (SunOpen . open)    ; R6 binding
  72.          (f18 . paste)
  73.          (SunPaste . paste)    ; R6 binding
  74.          (f19 . find)
  75.          (f20 . cut)
  76.          (SunCut . cut)        ; R6 binding
  77.          ;; help is ok
  78.          (f21 . pause)
  79.          (f22 . prsc)
  80.          (f23 . scroll)
  81.          ;; num_lock is ok
  82.          ;;(f24 . kp_equal)    ; type4 only!
  83.          (f25 . kp_divide)
  84.          (f26 . kp_multiply)
  85.          (f24 . kp_subtract)    ; type5 only!
  86.          (f27 . home)        ; note: not kp_7
  87.          ;; up is ok
  88.          (f29 . pgup)
  89.          ;; left is ok
  90.          (f31 . kp_5)
  91.          ;; right is ok
  92.          ;; kp_add is ok
  93.          (f33 . end)        ; the Sun name
  94.          (r13 . end)        ; the MIT name
  95.          ;; down is ok
  96.          (f35 . pgdn)
  97.          ;; insert is ok
  98.          ;; delete is ok
  99.          ;; kp_enter is ok
  100.          )))
  101.   ;; for each element in the left column of the above table, alias it to
  102.   ;; the thing the right column.  Then do the same for all possible modifier
  103.   ;; combinations. (Well, we omit hyper, super, and alt. #### Handle
  104.   ;; this some other way!)
  105.   (while mapping
  106.     (let ((mods '(() (shift) (control) (meta) (meta control) (meta shift)
  107.           (control shift) (control meta shift))))
  108.       (while mods
  109.     (let ((k1 (vector (append (car mods) (list (car (car mapping))))))
  110.           (k2 (vector (append (car mods) (list (cdr (car mapping)))))))
  111.       (define-key global-map k1 k2))
  112.     (setq mods (cdr mods))))
  113.     (setq mapping (cdr mapping))))
  114.  
  115.  
  116.  
  117. ;;; OpenWindows-like "find" processing.
  118. ;;; As far as I know, the `find' key is a Sunism, so we do that binding
  119. ;;; here.  This is the only Sun-specific keybinding.  (The functions 
  120. ;;; themselves are in x-win.el in case someone wants to use them when
  121. ;;; not running on a Sun display.)
  122.  
  123. (define-key global-map 'find        'ow-find)
  124. (define-key global-map '(shift find)    'ow-find-backward)
  125.  
  126. ;;; x-win-sun.el ends here
  127.